
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@include file="/WEB-INF/jsp/common/navigationRight.jsp"%>
<%@include file="/WEB-INF/jsp/common/head.jsp"%>
<%@include file="/WEB-INF/jsp/common/navigationLeft.jsp"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<style>
    #growth_scale {position:relative;width: 200px;display: inline-block;height: 16px;background-color: #f0f4f7;border-radius: 10px;line-height: 16px;font-size: 14px;}
    #growth_scale .bg {width:0;height: 16px;background-color: #5bd916;border-radius: 10px;overflow: hidden;}
    .m2-userMsg-iconLv span {padding-left:28px;font-size:16px;color:#f87450;}
    .m2-userMsg-iconLv a {width:98px;padding:38px 8px;height:0;}
    .m2-wel-lef .left {width:186px;text-align:center;height:240px;color:#f5944f;line-height:24px;font-size:12px;
    }
    .m2-wel-lef .left button {width:100px;height:40px;color:white;border:0;background-color:#fe6555;font-size:18px;border-radius:10px;margin-bottom:12px;}
    .m2-wel-lef .right {position:absolute;right:-20px;top:4px;width:240px;}
    .m2-wel-profitLink .m2-profit-cha{float:left;padding:0 20px;height:34px;line-height:34px;}
    .m2-userMsg-iconLv a i {top:30px;left:0;height:40px;}
</style>
<div style="width:100%; height:100%; position:fixed; z-index:100; display:none; top:0; left:0;" id="allP" >
    <div style="width:100%; height:100%; position:absolute; top:0; left:0; background:#000; opacity:0.5;"></div>
    <div style="width:404px; height:154px; background:#fff; position:absolute; top:50%; left:50%; margin-left:-252px; margin-top:-100px; border:2px solid #666;">
        <p style="color: #666666;font-size: 16px;position: absolute;line-height:170px;text-align: center; font-family: Microsoft YaHei;;">该项目已还清，为保护企业隐私，不再公示项目信息</p>
        <div style="width: 30px;height: 30px;position: absolute;top: 11px;right: 0px;color: #666;font-size: 20px;cursor: pointer;" id="close">X</div>
    </div>

</div>
<div class="m2-userCentermain-con">
    <div class="m2-msgBox">
        <b>通知<em></em></b>
        <span id='notice-text'></span>
        <a id='notice-url' href="usercenter-messagecontrol-sitemsg.html">&nbsp;&nbsp;[详情]</a>
        <i class="m2-msgBox-close" id='notice-close'></i>
    </div>
    <div class="m2-wel-con" style="background-color:white;width:798px;">
        <p class="m2-wel-hello" id='greeting' style="background-color:white;margin:0 10px;width: 730px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title='上午好，iqb13737301354，投资，是为了更好的自己！'>您好，${userSession.userCode}，投资，是为了更好的自己！</p>
        <div class="m2-wel-lef">
            <!--            <span style="position:absolute;top:85px;right:10px;font-size:15px;line-height:15px;">邀请码：<i style="font-style:normal;">xrejfr</i></span>-->
            <div class="left">
                <img src="${pageContext.request.contextPath }/statics/statics/usercenter/images/growth/vip.png" alt="爱钱帮" style="margin:20px;"><br>
                <button style="background-color:#b7b6b6;outline:none;" >已签到</button>                <p>您已连续签到<span id='day'>1</span>天，</p>
                <p><span id='today'>明天</span>再签到可获得<span id='growth'>2</span>个成长值</p>
            </div>
            <div class="right">
                <div class="m2-userMsg-iconLv" >
                    <a href="#" class="m2-iconLevel-normal"><i></i><span>
                    <c:if test="${0 < aqbUser.integral && aqbUser.integral <= 4000}">帮主</c:if>
                    <c:if test="${4000 < aqbUser.integral && aqbUser.integral <= 20000}">铁帮主</c:if>
                    <c:if test="${20000 < aqbUser.integral && aqbUser.integral <= 60000}">铜帮主</c:if>
                    <c:if test="${60000 < aqbUser.integral && aqbUser.integral <= 240000}">金帮主</c:if>
                    <c:if test="${ aqbUser.integral > 240000}">白金帮主</c:if>
                    </span></a>
                </div>

                <div>成长值：<span id="mydetail_num" data="240000">${aqbUser.integral}</span><a href="#" style="color:#69b1d7;float:right;">如何加速？</a></div>
                <div id="desc" style="margin:10px 0;font-size:12px;">距离
                    <c:if test="${0 < aqbUser.integral && aqbUser.integral <= 4000}">铁帮主&nbsp;还需要 <span id='integral'>${4000 - aqbUser.integral}</span></c:if>
                    <c:if test="${4000 < aqbUser.integral && aqbUser.integral <= 20000}">铜帮主&nbsp;还需要 <span id='integral'>${20000 - aqbUser.integral}</span></c:if>
                    <c:if test="${20000 < aqbUser.integral && aqbUser.integral <= 60000}">金帮主&nbsp;还需要 <span id='integral'>${60000 - aqbUser.integral}</span></c:if>
                    <c:if test="${60000 < aqbUser.integral && aqbUser.integral <= 240000}">白金帮主&nbsp;还需要 <span id='integral'>${240000 - aqbUser.integral}</span></c:if>
                     </span> 成长值</div>	            <div id="growth_scale"><div class='bg'></div></div>
                <ul style="margin:16px 0 10px 0;">
                    <li class="m2-userMsg-icon" style="margin-left:-8px;"><a href="#" id='verify_id' class="m2-iconUser-fal" title='实名认证'></a></li>
                    <li class="m2-userMsg-icon"><a href="#?phone=1" id='verify_phone' class="m2-iconPho-fal" title='手机认证'></a></li>
                    <li class="m2-userMsg-icon"><a href="#?email=1" id='verify_email' class="m2-iconEmail-fal" title='邮箱认证'></a></li>
                </ul>
                <div class="m2-wel-level" style="margin-left:0;">
                    <p>安全等级：<span class="m2-level-low" id='safe_level'  style="color:#1adb9e;"></span><a href="#" id='safe_level_url' style="color:#0996cc;">[提升]</a></p>
                </div>
            </div>
        </div>
        <div class="m2-wel-rig" style="float:right;width:320px;padding-top:66px;height:174px;border-left:1px solid #f0f0f0;">
            <div class="m2-wel-profitCon" >
                <div class="m2-wel-profit" style="width:142px;">
                    <p>
                        累计收益（元）
                        <b>
                            <u style="width:100px;z-index: 10;">
                                <em class="m2-userProfit-arr"></em>
                                <em class="m2-userProfit-arrBg"></em>
                                到账收益：0.00<br>
                            </u>
                        </b>
                    </p>
                    <span>${SumEarning}</span>
                </div>
                <div class="m2-wel-profit" style="width:142px;">
                    <p>
                        今日赚取（元）
                        <b>
                            <u style="width:120px;">
                                <em class="m2-userProfit-arr"></em>
                                <em class="m2-userProfit-arrBg"></em>
                                按在投项目精确计算的当天收益金额
                            </u>
                        </b>
                    </p>
                    <span>0.00</span>
                </div>
            </div>
            <div class="m2-wel-profitLink" style="padding-top:26px; margin-left:10px;">
                <a class="m2-profit-cha" href="/user/card?userId=${userSession.userId}">徽商充值</a>
                <a class="m2-profit-cha" href="/user/card?userId=${userSession.userId}" style="margin-left:54px;">徽商提现</a><!--                 -->
            </div>
        </div>
    </div>
    <div class="m2-userInd-num">
        <div class="border">
            温馨提示：因数据处理存在延迟，项目还款时数值会存在异常波动，还款后2小时银行完成对账后显示为正常值。
        </div>
        <ul>
            <li class="m2-userIndnum-item">
                <p class="m2-detail-tit">资产总计:
                </p>
                <span class="m2-detailNum-tur" style="color:#f5944f">${sumPrincipal + futuresumEarning + couldUseReward + 100000}</span>
                <i class="m2-userIndnum-equ" ></i>
            </li>
            <li class="m2-userIndnum-item">
                <p class="m2-detail-tit">待收本金:

                </p>
                <span class="m2-detailNum-fal">${sumPrincipal}</span>
                <i class="m2-userIndnum-add"></i>
            </li>
            <li class="m2-userIndnum-item">
                <p class="m2-detail-tit">待收收益:
                </p>
                <span class="m2-detailNum-fal">${futuresumEarning}</span>
                <i class="m2-userIndnum-add"></i>
            </li>
            <li class="m2-userIndnum-item">
                <p class="m2-detail-tit">可用奖励金:
                </p>
                <span class="m2-detailNum-fal">${couldUseReward}</span>
                <i class="m2-userIndnum-add"></i>
            </li>
            <li class="m2-userIndnum-item">
                <p class="m2-detail-tit">账户余额:
                    <b class="m2-detail-titIcon">
                        <u style="width:160px;text-align:left">
                            <em class="m2-detail-titHide-arr"></em>
                            <em class="m2-detail-titHide-arrBg"></em>
                            <!---->
                            徽商账户余额：0.00                        </u>
                    </b>
                </p>
                <span class="m2-detailNum-fal">100000</span>
            </li>
        </ul>
    </div>

    <div class="m2-user-invest">
        <div class="m2-user-invest-head">
            <h3><i></i>最近投资记录</h3>
            <hr style="display:inline-block;width:148px;border:0;background-color:#0996cc
				;height:1px;margin-left:6px;"></h3>
            <hr style="display:inline-block;width:642px;border:0;background-color:#dadada;height:1px;margin-left:-4px;"></h3>
        </div>
        <div class="m2-user-invest-list">
            <table class="m2-userInvest-table"  cellpadding="0" cellspacing="0" >
                <tr class="m2-userInevst-head" >
                    <th style="width:150px;">项目名称</th>
                    <th style="width:130px;">投资金额</th>
                    <th style="width:110px;">收益率</th>
                    <th style="width:120px;">周期</th>
                    <th style="width:120px;">投资日期</th>
                    <th style="width:148px;"></th>
                </tr>
                <c:forEach items="${aqbInvestmentList2}" var="Investment" varStatus="row">
                    <tr class="m2-userInevst-head" >
                        <th style="width:150px;">${Investment.proName}</th>
                        <th style="width:130px;">${Investment.investAmount}</th>
                        <th style="width:110px;">${Investment.rate}</th>
                        <th style="width:120px;">${Investment.period}</th>
                        <th style="width:120px;"><fmt:formatDate pattern="yyyy-MM-dd" value="${Investment.investDate}"/></th>
                        <th style="width:148px;"></th>
                    </tr>
                </c:forEach>
            </table>
        </div>
    </div>
</div>
<div style="display:none;">
    <span id='ntitle'></span>
    <span id='nmsg'></span>
</div>

<script>
    $(function(){
        var scale=$("#mydetail_num").text()/$("#mydetail_num").attr("data")*100+"%";
        $("#growth_scale .bg").animate({width:scale},900);
        $('#sign').click(function(){
            var active_id='0';
            $.ajax({
                type:"POST",
                url: "/usercenter-Index-sign_in",
                data: {active_id:active_id},
                success: function (data) {
                    var obj=JSON.parse(data);
                    var data = obj.data;
                    if(obj.resultcode==41001){
                        if(data.level==4 ||data.level==5){
                            $("#mydetail_num").attr("data",data.growthvalue);
                        }else{
                            $("#mydetail_num").attr("data",parseInt(data.growthvalue+data.integral));
                        }
                        $("#mydetail_num").text(data.growthvalue);
                        $("#sign").css("backgroundColor","#b7b6b6");
                        $("#sign").text('已签到');
                        $('#day').html(parseInt($('#day').html())+1);
                        var growth=parseInt($('#growth').html())+1;
                        if (growth>=10){
                            growth=10;
                        }
                        $('#growth').html(growth);
                        $('#today').html('明天');
                        var scale=$("#mydetail_num").text()/$("#mydetail_num").attr("data")*100+"%";
                        $("#growth_scale .bg").animate({width:scale},900);
                        $('#integral').html(data.integral);
                        $('#vipname').html(data.name);
                        switch(data.level){
                            case 0:
                                $('.right .m2-userMsg-iconLv a').attr('class','m2-iconLevel-normal');
                                $('.right .m2-userMsg-iconLv a span').text('帮主');
                                break;
                            case 1:
                                $('.right .m2-userMsg-iconLv a').attr('class','m2-iconLevel-iron');
                                $('.right .m2-userMsg-iconLv a span').text('铁帮主');
                                break;
                            case 2:
                                $('.right .m2-userMsg-iconLv a').attr('class','m2-iconLevel-copper');
                                $('.right .m2-userMsg-iconLv a span').text('铜帮主');
                                break;
                            case 3:
                                $('.right .m2-userMsg-iconLv a').attr('class','m2-iconLevel-gold');
                                $('.right .m2-userMsg-iconLv a span').text('金帮主');
                                break;
                            case 4:
                                $('.right .m2-userMsg-iconLv a').attr('class','m2-iconLevel-paltinum');
                                $('.right .m2-userMsg-iconLv a span').text('白金帮主');
                                $('#desc').text('您已然是一人之下，万人之上，无比荣耀');
                                break;
                            case 5:
                                $('.right .m2-userMsg-iconLv a').attr('class','m2-iconLevel-svip');
                                $('.right .m2-userMsg-iconLv a span').text('特邀帮主');
                                $('#desc').text('爱钱帮最高等级，王者荣耀');
                                break;
                        }
                    }
                }
            });
        })
    })
    var oP=document.getElementById('allP');
    var oClose=document.getElementById('close');
    //oP.style.display='none';
    oClose.onclick=function(){
        oP.style.display='none';
    };

    /**
     * 已结束的项目不允许查看合同
     */
    function linkContractContract(that){
        var bid=that.getAttribute('bid');
        var status = that.getAttribute('status');
        if(status==7||status==11){
            oP.style.display='block';
        } else {
            window.open("member-contract-investor.shtml?id="+bid,"_blank");
        }
    }
    /**
     * 已结束的项目不允许查看合同
     */
    function linkContracttransContract(that){
        var bid=that.getAttribute('bid');
        var status = that.getAttribute('status');
        if(status==7||status==11){
            oP.style.display='block';
        } else {
            window.open("member-contracttrans-investor.shtml?id="+bid,"_blank");
        }
    }
    /**
     * 已结束的项目不允许下载合同
     */
    function linkDownload(that){
        var bid=that.getAttribute('bid');
        var status = that.getAttribute('status');
        if(status==7||status==11){
            oP.style.display='block';
        } else {
            window.open("Member-Contract-createAndSendPdfbyid?id="+bid,"_blank");
        }
    }
</script>

<script>

    $(document).ready(function () {
        //用户通知
        getMsg();
        //用户问候语图标
        getGreeting();

        //用户认证
        userVerify();
        //收益金颜色
        moneyColor();
        //异步加载月收益图
        loadMonChart();
        fitBottom();
    });

    function getMsg() {

        var title = $('<div>' + $('#ntitle').text() + '</div>').text();
        var msg = $('<div>' + $('#nmsg').text() + '</div>').text();
        if (title == '') {
            $('.m2-msgBox').hide();
        }
        if (title.length > 10) {
            $('#notice-text').text(title);
        } else {
            if (!msg) {
                $('.m2-msgBox').hide();
            } else {
                if (msg.length > 55) {
                    msg = msg.substr(0, 55);
                    msg += '...  ';
                }
                $('#notice-text').text(msg);
            }
        }
    }

    function getGreeting() {

        var date = new Date();
        var H = date.getHours();
        if (H < 5) {
            icon = '<i class="m2-hello-nig">';
        } else if (H < 12) {
            icon = '<i class="m2-hello-mor">';
        } else if (H < 18) {
            icon = '<i class="m2-hello-aft">';
        } else if (H < 20) {
            icon = '<i class="m2-hello-nig">';
        } else {
            icon = '<i class="m2-hello-nig">';
        }
        $('#greeting').prepend(icon);
    }

    function userVerify() {

        var i = 0;
        if (1 == '0') {
            $('#verify_id').prop('class', 'm2-iconUser-tur');
            i++;
        }
        if (1 == '1') {
            $('#verify_phone').prop('class', 'm2-iconPho-tur');
            i++;
        }
        if (1 == '0') {
            $('#verify_email').prop('class', 'm2-iconEmail-tur');
            i++;
        }
        if (i == 1) {
            $('#safe_level').text('低');
        } else if (i == 2) {
            $('#safe_level').text('中');
        } else if (i == 3) {
            $('#safe_level').text('高');
            $('#safe_level_url').hide();
        } else {
            $('#safe_level').text('极低');
        }
        var j = 0;
        $('#safe_level_bar i').each(function () {
            if (j < i) {
                $(this).prop('class', 'm2-levelIcon-tur');
                j++;
            }
        });
    }

    function moneyColor() {

        var a;
        $('span.m2-detailNum-fal').each(function () {
            a = $(this).text();
// 			if(!isNaN(a)){
            if (a != 0) {
                $(this).prop('class', 'm2-detailNum-tur');
            } else {
                $(this).text('0.00');
            }
// 			}
        });
    }

    function loadMonChart() {

        $('.m2-chartLoading').show();
        $.ajax({
            url: "usercenter-Index-getIncomeList",
            data: {},
            success: function (data) {
                $('.m2-chartLoading').hide();
                var obj = eval('(' + data + ')');
                monthData = getList(obj.monlist, 'income');
                monthCate = getList(obj.monlist, 'month');
                dailyData = getList(obj.daylist, 'income');
                dailyCate = getList(obj.daylist, 'day');
                loadChartmonth(monthData, monthCate);
            }
        });
    }

    function getList(data, key) {
        var l = Array();
        for (k in data) {
            l.push(data[k][key]);
        }
        return l;
    }
    function getPaymentDetail(date) {
        //日期.分割
        window.location.href = '/usercenter-investcontrol-dayrepayment?date=' + date;
    }
    //日历日期点击事件
    function getPaymentList(y, m, d) {
        window.location.href = '/usercenter-investcontrol-dayrepayment?date=' + y + '.' + m + '.' + d;
    }


    //提示框
    function showMsgs(text) {
        $('#dialog-info-div').show();
        $('#dialog-info-text').text(text);
    }
    $('.m2-userCentercommon-confirmClose,.m2-user-confirmBtn').click(function(){
        $('#dialog-info-div').hide();
        $('#dialog-info-text').text("");
    });
    var card = '';

    function showMsg() {

        //当前银行卡
        if(!card) {
            //没有绑卡
            showMsgs('您还未绑卡，现在确定去绑卡吗？');
            return;
        } else {
            $('.m2-userCommon-confirmSuc').html('使用一键转账功能可将您的汇付账户中资金转移至您的徽商银行账户（无任何手续费），资金预计在1-3个工作日内到账，请耐心等候！');
            $('.m2-userCentercommon-bg').show();
            //  $('.m2-userCentercommon-confirm').show();
            $('#dialog-info-div1').show();
            return;
        }
    }
</script>
<script type="text/javascript" src="/statics/statics/usercenter/js/m2-userCenter.js?20160520"></script>

</div>
</div>
</body>
</html>